package pl.accuratus.exmore.client.spi;

import java.lang.annotation.Annotation;
import java.util.HashSet;
import java.util.Set;

public abstract class AbstractExtensionPoint<T extends Annotation> implements ExtensionPoint<T> {
	private final Set<ExtensionMetaData<T>> extensions = new HashSet<ExtensionMetaData<T>>();
	
	@Override
	public Set<ExtensionMetaData<T>> getExtensions() {		
		return new HashSet<ExtensionMetaData<T>>(extensions);
	}
	
	@Override
	public void registerExtension(ExtensionMetaData<T> extension) {
		if(extension==null)return;
		
		if(!extensions.contains(extension))
			extensions.add(extension);
	}
}
